<?php

/**
 * The index file: It is in this file that we will also call a helper file to initialize a few values.
 * 
 * @author: Johan <info@johandahlberg.com>
 */

/*** error reporting on ***/
error_reporting(E_ALL);

/*** define the site and app path constant ***/
defined('__SITE_PATH')
    || define('__SITE_PATH', realpath(dirname(__FILE__)));

defined('__APP_PATH')
    || define('__APP_PATH', realpath(dirname(__FILE__) . '/../application'));

/*** include the Boostrap.php file ***/
include '../application/Bootstrap.php';

/*** save url path to registry ***/
$site_path = str_replace("index.php", "", "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']);
$registry->__set("url_path", $site_path);

/*** load the router ***/
$registry->router = new router($registry);


/*** set the controller path ***/
$registry->router->setPath (__APP_PATH . '/controllers');

/*** load up the template ***/
$registry->template = new template($registry);

/*** load the controller ***/
$registry->router->loader();

?>